Clean Mesh

require.mx('mxjs/mesh/clean-mesh.js');

This is the clean mesh library.

StatusName
Boolean checkForIntersections ( Object mesh, Object edgeList, Object subgraphs )

Check if mesh has faces that are intersecting. Requires Triangle Normals already be calculated.

Object cleanClosedMesh ( Object settings )

Determines if a point is inside a mesh. Assumes that each subgraph in the mesh is close and cleaned (see clean-mesh.js library).

  • errorMessages : Array for the error messages.
  • mesh : mesh-ta object.
  • deduplify (optional): Boolean. Deduplify idential faces?
  • patchHoles (optional): Boolean. Try patch holes in mesh?
  • translateToOrigin (optional): Boolean. Translat mesh to origin?
  • cleanInternalSurfaces (optional) : Boolean. Clean internal surfaces?
  • onlyKeepLargest (optional) : Boolean. Only keep the largest surface?
  • simplifyMeshes (optional) : Boolean. Simplify mesh?
  • targetIterations (optional) : Stop the simplification process when the triangle count is less than or equal to this number. .
  • maximumErrorThreshold (optional) : A function that receives the current iteration (number) and returns the threshold to use for this iteration (number). The simplifier will only consider collapsing edges if the error introduced by the edge collapse would be lower than this threshold.
  • checkIntersections (optional) : Boolean. Check if mesh is self-intersecting?
Return the following object:
  • translation - vector
  • hasIntersections - boolean
  • isManifold - boolean

patchHoles ( Object mesh )

Patches holes in match surface Should de-duplify mesh first.

removeDuplicateFaces ( Object mesh )

Removes duplicate faces from object


Library Functions

result = Lib.checkForIntersections ( mesh, edgeList, subgraphs )

Check if mesh has faces that are intersecting. Requires Triangle Normals already be calculated.

Parameters:
  • Object mesh - - Mesh-TA object.
  • Object edgeList - - Mesh-TA EdgeList object.
  • Object subgraphs - - Mesh-TA subgraphs object.
Returns: Boolean result - - Return true if mesh has intersections and false otherwise
results = Lib.cleanClosedMesh ( settings )

Determines if a point is inside a mesh. Assumes that each subgraph in the mesh is close and cleaned (see clean-mesh.js library).

  • errorMessages : Array for the error messages.
  • mesh : mesh-ta object.
  • deduplify (optional): Boolean. Deduplify idential faces?
  • patchHoles (optional): Boolean. Try patch holes in mesh?
  • translateToOrigin (optional): Boolean. Translat mesh to origin?
  • cleanInternalSurfaces (optional) : Boolean. Clean internal surfaces?
  • onlyKeepLargest (optional) : Boolean. Only keep the largest surface?
  • simplifyMeshes (optional) : Boolean. Simplify mesh?
  • targetIterations (optional) : Stop the simplification process when the triangle count is less than or equal to this number. .
  • maximumErrorThreshold (optional) : A function that receives the current iteration (number) and returns the threshold to use for this iteration (number). The simplifier will only consider collapsing edges if the error introduced by the edge collapse would be lower than this threshold.
  • checkIntersections (optional) : Boolean. Check if mesh is self-intersecting?
Return the following object:
  • translation - vector
  • hasIntersections - boolean
  • isManifold - boolean

Parameters:
  • Object settings - - an object containing configuration with keys/values as described.
Returns: Object results - - an object containing configuration with keys/values as described.
Lib.patchHoles ( mesh )

Patches holes in match surface Should de-duplify mesh first.

Parameters:
  • Object mesh - - Mesh-TA object.
Lib.removeDuplicateFaces ( mesh )

Removes duplicate faces from object

Parameters:
  • Object mesh - - Mesh-TA object.